package com.cp.mtq.controller;

import com.cp.mtq.bean.Result;
import com.cp.mtq.utils.FileUtil;
import com.cp.mtq.utils.ResultUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
public class MtqFileController {

    @PostMapping("upload")
    public Result upload(MultipartFile file){
        String path = FileUtil.localUpload(file);
        return new ResultUtil<String>().setData("http://tuoguanjy.cn/mtq/files"+path);
    }
}
